Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DotNetNuke Text\HTML Javascript Redirect

Posted on 2010-08-31
7
Medium Priority
?
1,103 Views
Last Modified: 2012-05-10
Hello,
I am sure this is a very stupid question, but I am rather new to web coding.
I am trying to make a simple little form in DotNetNuke with a Text\HTML module that will allow me to have a couple text entry boxes, and append those as querystring variables to a javascript redirect button. When I try do this with window.location.replace('URL') in my onclick, it just refreshes back to the same page (not the page I want to redirect to). when I use window.open('url') that works, but it goes to a new window.
What am I doing wrong?
0
Comment
Question by:markterry
  • 4
  • 2
7 Comments
 
LVL 6

Expert Comment

by:thaytu888888
ID: 33574082
- Try window.location = yourURL;
0
 
LVL 1

Expert Comment

by:talktodhand
ID: 33574123
function redirect()
    {
        location.href = "newURL";
    }
0
 
LVL 6

Author Comment

by:markterry
ID: 33574208
Neither work, also alert("Hello World!"); does work. I am starting to think there is something in the CMS stopping this code.
also thatyu888888, I thought windows.location causes a loop when people use the back button.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Author Comment

by:markterry
ID: 33574260
okay, new news... window.location.redirect works in IE, but not Chrome or FireFox. So kinda good, but obviuosly I would want it to work in all browsers.
0
 
LVL 1

Accepted Solution

by:
talktodhand earned 2000 total points
ID: 33574306
Hi,

works on IE,Chrome and FireFox too....
I have tried following code:

<html>
<head>
<script>
function redirect()
{
      window.location.href="http://www.google.com";
}
</script>
</head>
<body>
<input type=button onclick=redirect();>
</body>
</html>

Hope it will help.
0
 
LVL 6

Author Comment

by:markterry
ID: 33582582
that indeed does the trick talktohand. adding the window before location.href seems to be working.
0
 
LVL 6

Author Closing Comment

by:markterry
ID: 33582590
Thank you for your help.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question