Click to See Complete Forum and Search --> : What's wrong with this document.write code?
gokou
06-11-2003, 03:31 PM
document.write('<tr><td align="center"><a href="#" onClick="openwindow(\'http://www.blahblahblah.com/cgi-bin/cash.cgi?id=jason&ps=bleh\',\'window\', \'width=600,height=600,location=no\'), onMouseOver=statusbar()\'; return true"><img src="oa_gr009.gif" name="img_001x192x120" width="192" height="120" border="0"></a></td>');
I get an error saying object expected. I've been trying to fix it for awhile, i'm sure it's got something to do with one of the apstrophies in the wrong place.
JackTheTripper
06-11-2003, 03:36 PM
document.write('<tr><td align="center"><a href="#" onClick="openwindow(\'http://www.blahblahblah.com/cgi-bin/cash.cgi?id=jason&ps=bleh\',\'window\', \'width=600,height=600,location=no\'), onMouseOver=statusbar(); return true"><img src="oa_gr009.gif" name="img_001x192x120" width="192" height="120" border="0"></a></td>');
Try that. Took out the ' right after onMouseOver=statusbar();
Yep, a few quotes errors. Try this one out:
<script language="javascript" type="text/javascript">
document.write('<tr><td align="center"><a href="#" onClick="openwindow(\'http://www.blahblahblah.com/cgi-bin/cash.cgi?id=jason&ps=bleh\',\'window\', \'width=600,height=600,location=no\');" onMouseOver="statusbar(); return true;"><img src="oa_gr009.gif" name="img_001x192x120" width="192" height="120" border="0"></a></td>');
</script>
Charles
06-11-2003, 03:39 PM
1) How is your page going to work for the 13% of users who do not use JavaScript?
2) Run this and you will see where the problem lies:
<script type="text/javascript">
<!--
alert('<tr><td align="center"><a href="#" onClick="openwindow(\'http://www.blahblahblah.com/cgi-bin/cash.cgi?id=jason&ps=bleh\',\'window\', \'width=600,height=600,location=no\'), onMouseOver=statusbar()\'; return true"><img src="oa_gr009.gif" name="img_001x192x120" width="192" height="120" border="0"></a></td>');
// -->
</script>
gokou
06-11-2003, 04:30 PM
This is hard. I still can't get it to work and I think I tryed all the methods posted.
pyros method didn't work because I have to have those backslashes in there or it brings up a blank screen. All the other methods just displayed the same error.
The forums mis-formated my post. It removed all my backslashes... Try this:
gokou
06-11-2003, 07:33 PM
Thanks for all the help. It still doesn't work though, but I don't want to keep bothering everyone.
But, if you still want to help, here is more info http://www.uo-gold.no-ip.com/code.txt. Maybe you need to see the whole code to fix the problem? I didn't think so because the problem happened when I put that last code in.
Also, I fiddled with the code since I tryed the install code.
Change openwindow(...) to window.open(...) or try this:
gokou
06-12-2003, 01:02 AM
Ok. I got rid of the openwindow function and just used window.open(the function was pointless anyways) and now the open.window works'. The default.status still isn't working and I tryed the code you put. Also, I read if you want to use two event handlers in one, you need to only put a double quation mark at the beginning of the first event handler statement and at the end of the second event handler statement.
for example:
onMouseOver="statusbar(), onClick=window.open(...); return true"
I'm pretty sure i've tryed that already, it seems like i've tryed everything. The problem might have something to do with document.write mixed with the event handlers except that doesn't make sense because It works if I just use 1 event handler. I'm not sure exactly...
Nope, that's not how you do it. You do it like this:
onmouseover="statusbar(); return true;" onclick="window.open(...);"
Anyway, the problem was probably with your statusbar() function. Try this:
gokou
06-12-2003, 12:11 PM
The computer with all my stuff on it just crashed. I'm on another computer, so i'll have to try the code after I get it fixed.
gokou
06-12-2003, 09:52 PM
damn. I just found where the error was, it was in the statusbar() function. I had ; at the end of statusbar().
I'm trying to make it so that there is no way someone can look at the source or hover over a link and see a certain id in the link. Which is why I have the whole page in document.writes, if somone has javascript disabled, I wouldn't want them to go to it. Disabling right click only works for ie(I think) so, I'm going to use an "if" statement to detect if there using another browser, if they are, it will print "you have to use ie" or something.
With all these methods i'm using, would it still be possible for someone to view the source or links in statusbar?
gokou
06-12-2003, 11:34 PM
This is my last step, detecting the browser. I'm having trouble with the code. It's suppose to detect if the browser is not internet explorer then display a message if it isn't, but it's doing everything backwards'. If I use internet explorer, it displays the message, but if I use netscape, it shows thhe page.
function checkBrowser() {
if (!navigator.appName.search(/Microsoft/i)) {
document.write("You must use microsoft internet explorer")
}
}
James L.
06-13-2003, 12:02 AM
"I'm trying to make it so that there is no way someone can look at the source or hover over a link and see a certain id in the link. Which is why I have the whole page in document.writes, if somone has javascript disabled, I wouldn't want them to go to it. Disabling right click only works for ie(I think) so, I'm going to use an "if" statement to detect if there using another browser, if they are, it will print "you have to use ie" or something. "
I am curious why you would go to such extreme lengths to hide your source (which is pretty much completely impossible to do. Someone in the know could just save/download the pages and look at them in an editor). I am definitely not trying to preach an "accessibility" arguement here, but forcing a user to use javascript and a certain browser to view a site seems limiting... just wondering why?
gokou
06-13-2003, 12:13 AM
Theres a site I just signed up with, where you put lots of there banners on your pages and your user id is in the link of each banner. If someone clicks on the banner and the site makes a sale from it, I would get some money. I'm sure this will be frowned on, but I was going to spam emails and get lots of sales, but the site says they don't tolerate spamming and will remove your account if you do it. So, I was trying to make a page where there is no way they can tell who it is, even the the banners open up with a new window without the address bar so they can't see my id in the link.
Do you think it would work or would they find out? I don't think alot of people would take such measures to download the page.
JackTheTripper
06-13-2003, 01:48 PM
Even though the link opens in a new window where you've not provided an address bar, they can still Ctrl+N and the same page opens in a new window WITH the address bar showing www.stuffyoudon'tneed.com?referID=1234567
That's in IE BTW.