简体   繁体   中英

Adding anchor tag to javascript URL

I have a PHP system and basically I use a popup lay to do some processing, ie upload an image. No problems here and then on completing the insert and upload I go to a page which will call the underlying page and refresh it:

$callpage="jobsheet_build.php?id=".$_GET['id'];
echo("<script language=\"javascript\">");
echo("top.location.href = \" ").$callpage.("\";");
echo("</script>"); 

OK this works fine, but in the ideal world I would like to put a reference to #images in the $callpage so I end up with

$callpage="jobsheet_build.php?id=".$_GET['id']."#images";

but the javascript just hangs no matter what I do.

Any ideas would be very greatly appreciated!

@Jim Have you tried to set the anchor tag like this echo("top.location.href = \\" ").$callpage.("#images\\";"); instead of set the anchor tag inside the variable ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM