JChilds Posted June 18, 2008 Share Posted June 18, 2008 I'm using javascript:document.getElementById("QUESTION").innerHTML = "ANSWER"; It works perfectly. It changes the text. BUT, a millisecond after it has changed the text, It takes e to a new page with ANSWER on it. Any idea why this is happening? Link to comment https://forums.phpfreaks.com/topic/110702-solved-getelementbyid-takes-me-to-new-page/ Share on other sites More sharing options...
xtopolis Posted June 18, 2008 Share Posted June 18, 2008 Probably because you're using "javascript:" in a place where you could use an event handler. We need to see more code to help you out. Link to comment https://forums.phpfreaks.com/topic/110702-solved-getelementbyid-takes-me-to-new-page/#findComment-567970 Share on other sites More sharing options...
JChilds Posted June 18, 2008 Author Share Posted June 18, 2008 Thats all the code there is. I only have access to the code of one button..., So i have to use javascript: Link to comment https://forums.phpfreaks.com/topic/110702-solved-getelementbyid-takes-me-to-new-page/#findComment-567979 Share on other sites More sharing options...
xtopolis Posted June 18, 2008 Share Posted June 18, 2008 Show us the code containing the element with the id "QUESTION".... You're giving us not enough to go on. Link to comment https://forums.phpfreaks.com/topic/110702-solved-getelementbyid-takes-me-to-new-page/#findComment-568010 Share on other sites More sharing options...
JChilds Posted June 18, 2008 Author Share Posted June 18, 2008 <td><span id="QUESTION" title="717" >3157</span> </td> Link to comment https://forums.phpfreaks.com/topic/110702-solved-getelementbyid-takes-me-to-new-page/#findComment-568023 Share on other sites More sharing options...
haku Posted June 18, 2008 Share Posted June 18, 2008 Add 'return false' to the next line after that. Link to comment https://forums.phpfreaks.com/topic/110702-solved-getelementbyid-takes-me-to-new-page/#findComment-568059 Share on other sites More sharing options...
JChilds Posted June 18, 2008 Author Share Posted June 18, 2008 That did'nt work. but it put me on the right track! Adding exit worked a treat. Thanks! Link to comment https://forums.phpfreaks.com/topic/110702-solved-getelementbyid-takes-me-to-new-page/#findComment-568072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.