Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Jquery page change

Explorer ,
Jun 22, 2011 Jun 22, 2011

I'm building my first mobile app using the Jquery sample page that has all of the app/site pages in a single file. Everything is working fine except that I need to execute a javascript when an internal page loads. I'm setting a sessionStorage variable when the internal link is clicked and need to use that variable to update an image when the requested page loads.

Here's the link on my page:

<a href="javascript:displayNewImage(8)">Image 8</a>

and my function:

function displayNewImage(imageNum) {
    alert('Image #' + imageNum + ' selected');
    sessionStorage.imageNum = imageNum;
    location.hash = "#images"; 
}

The last line in the function loads the internal page successfully but I need to change the image that is already on that page based on the sessionStorage.imageNum variable but can't figure how to anything but load the page with whatever was on it originally. The image is in a div on the page like so:

<div id="dispalyImage"><img src="image1.png"></div>

Thanks in advance for any input.

Michael

TOPICS
Server side applications
331
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 22, 2011 Jun 22, 2011
LATEST

Might need to clarify that the link that navigates to the page where I need to change the image is on a separate page (internal div with data-role="page") -- so I'm clicking a link on page one - setting a sessionStorage variable - and then navigating to page to where I need to update the image.

Thanks.

M

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines