Solved

javascript redirect

Posted on 2007-04-03
8
440 Views
Last Modified: 2012-05-05
hi,

i have an input type image with an onclick event that should redirect the page, but it doesnt work.

any ideas why? it does work if i change the type to "button" rather than "image"


<input type="image" src="images/transparent.gif" id="button-refresh" class="button right" name="refresh" value="Refresh" alt="Refresh" title="Refresh" onmouseover="this.style.backgroundPosition='left bottom'" onmouseout="this.style.backgroundPosition='left top'"onClick="location.href='macresv.html'" />
0
Comment
Question by:coolispaul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 18842368
Hello coolispaul

try

onClick="window.location.href='macresv.html'"

HTH

!i!
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18842385
Also, you should add a space just before onClick, there is none at the moment...
0
 
LVL 11

Expert Comment

by:flipz
ID: 18842396
<img src="images/transparent.gif" id="button-refresh" class="button right" name="refresh"  alt="Refresh" title="Refresh" onmouseover="this.style.backgroundPosition='left bottom'" onmouseout="this.style.backgroundPosition='left top'" onClick="location.href='macresv.html'" />

Input image? Not familiar with that one - try using img tag - you'll just need to figure out how to include the text 'Refresh' - part of the image itself would probably be best.

BTW - your script fires the onClick event fine for me in IE7 - make sure there is a space between the tag properties:
onmouseout="this.style.backgroundPosition='left top'" onClick="location.href='macresv.html'"
0
A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

 

Author Comment

by:coolispaul
ID: 18842447
hi,

none of that works unfortunately. As you say it does trigger the onclick event but the page isnt redirected. In firefox the browser says "stopped"

0
 
LVL 11

Expert Comment

by:flipz
ID: 18842472
Seems to work fine in my FF browser. Since the example you provided does not include the style - it may have problem there?? Can a style have a space in the name? Try class="buttonright".
0
 

Author Comment

by:coolispaul
ID: 18842547
hi,

ive realised the problem is because its is inside a form. if you strip the from and leave it as just input it works.

i guess i will have to use form.submit or something along those lines unless you know of any other work arounds?
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19300239
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

615 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