Help regarding master pages
-
hi all, I have a master page which includes some javascript code to get the current mouse position. i have 2 aspx pages which uses this master page and i need to use the javascript defined in master page in my two aspx pages. How can i call them?
Thanks in advance.:) Regards Anuradha
-
hi all, I have a master page which includes some javascript code to get the current mouse position. i have 2 aspx pages which uses this master page and i need to use the javascript defined in master page in my two aspx pages. How can i call them?
Thanks in advance.:) Regards Anuradha
call javascript onmouseover event of body of master page. for example
bEst rEgard
pAthanplease don't forget to vote on the post that helped you.
-
call javascript onmouseover event of body of master page. for example
bEst rEgard
pAthanplease don't forget to vote on the post that helped you.
hi, thanks for your help. i used the following code function getX(evt) { if (document.all) { return (evt.clientX); } return (evt.layerX); } function getY(evt) { if (document.all) { return (evt.clientY); } return (evt.layerY); } function getScrollX() { if (document.all) { return (document.body.scrollLeft); } return (window.pageXOffset); } function getScrollY() { if (document.all) { return (document.body.scrollTop); } return (window.pageYOffset); } function showValues(e) { var posx = 0; var posy = 0; posx= getX(e) + getScrollX(); posy= getY(e) + getScrollY(); } and called the function showValues(event) in mousemove event of the body of master page as u described. i need to use the variables posx and posy in my content pages. How can it be done???
Thanks Regards Anuradha
-
hi, thanks for your help. i used the following code function getX(evt) { if (document.all) { return (evt.clientX); } return (evt.layerX); } function getY(evt) { if (document.all) { return (evt.clientY); } return (evt.layerY); } function getScrollX() { if (document.all) { return (document.body.scrollLeft); } return (window.pageXOffset); } function getScrollY() { if (document.all) { return (document.body.scrollTop); } return (window.pageYOffset); } function showValues(e) { var posx = 0; var posy = 0; posx= getX(e) + getScrollX(); posy= getY(e) + getScrollY(); } and called the function showValues(event) in mousemove event of the body of master page as u described. i need to use the variables posx and posy in my content pages. How can it be done???
Thanks Regards Anuradha
anu81 wrote:
i need to use the variables posx and posy in my content pages.
Why ? After rendering and showing the page to the browser, there is no separation like Master/Content page. All will be rendered to produce a single page. So whatever client side script you are writing on Master/Content page will be in same page after rendering. So what's your problem ?
-
anu81 wrote:
i need to use the variables posx and posy in my content pages.
Why ? After rendering and showing the page to the browser, there is no separation like Master/Content page. All will be rendered to produce a single page. So whatever client side script you are writing on Master/Content page will be in same page after rendering. So what's your problem ?
hi, thanks for your reply. i too thought the same that the entire page is rendered and there is no difference between master and content page. But when i access the values posx and posy in a javascript function from the content page like this, function fnZoomImage(comment_text) { oDiv = document.getElementById('idPOPUP'); if (oDiv != null) window.document.body.removeChild(oDiv); oDiv = window.document.createElement("DIV"); oDiv.style.position="absolute"; oDiv.style.visibility = "visible"; oDiv.style.padding = "1px"; oDiv.style.width = "0px"; oDiv.style.height = "0px"; oDiv.style.border = "0px"; oDiv.style.left = posx + "px"; oDiv.style.top = posy + "px"; oDiv.id = "idPOPUP"; oDiv.innerHTML = ""+ ""+ " "+ ""+ "
"+ " " + comment_text + "
"; window.document.body.appendChild(oDiv); } i get a error saying posx is undefined.
Thanks Regards Anuradha
-
hi, thanks for your reply. i too thought the same that the entire page is rendered and there is no difference between master and content page. But when i access the values posx and posy in a javascript function from the content page like this, function fnZoomImage(comment_text) { oDiv = document.getElementById('idPOPUP'); if (oDiv != null) window.document.body.removeChild(oDiv); oDiv = window.document.createElement("DIV"); oDiv.style.position="absolute"; oDiv.style.visibility = "visible"; oDiv.style.padding = "1px"; oDiv.style.width = "0px"; oDiv.style.height = "0px"; oDiv.style.border = "0px"; oDiv.style.left = posx + "px"; oDiv.style.top = posy + "px"; oDiv.id = "idPOPUP"; oDiv.innerHTML = ""+ ""+ " "+ ""+ "
"+ " " + comment_text + "
"; window.document.body.appendChild(oDiv); } i get a error saying posx is undefined.
Thanks Regards Anuradha
anu81 wrote:
i get a error saying posx is undefined.
Your script is a mess. Variable
posx
is declared inside a function, and you are accessing that from another function. This is not possible because variableposx
scope ends when the first function ends. So how you can access it here ? Try makingposx
declare outside the function. But I am not sure that you can access variables declared on different script blocks. If it's not working put a hidden textbox and assign theposx
value there. Then read from this hidden textbox in the content page and assign to another variable.
-
anu81 wrote:
i get a error saying posx is undefined.
Your script is a mess. Variable
posx
is declared inside a function, and you are accessing that from another function. This is not possible because variableposx
scope ends when the first function ends. So how you can access it here ? Try makingposx
declare outside the function. But I am not sure that you can access variables declared on different script blocks. If it's not working put a hidden textbox and assign theposx
value there. Then read from this hidden textbox in the content page and assign to another variable.