English 中文(简体)
装饰背景图像,从其他网页上打碎??
原标题:load background image from other page with jquery?
  • 时间:2011-02-25 14:36:00
  •  标签:
  • jquery

我想从另一个雅克斯网页上打上一个背景形象,而实际上看不出什么最佳方法?

In my index.html page I have the css background code and I want to load an image from another asp page.

我的索引..html

<div id="bgimage" style="background-image: url(../images/theimage.jpg); background-repeat: no-repeat; background-position: center center; background-attachment:fixed;">

and the imagepage.asp page that gets the right image from the db.

<div id="menuimage">
<img src="..user_images/<%=folderName%>/menuimage/<%=rs("big_image")%>" id="themenyimage"/>
</div>

任何建议都会得到理解。

问题回答

大致如下:

var temp_div = $( <div></div> );
temp_div.load( path.asp #menuimage , function() {
    $( #bgimage ).css( background-image , temp_div.find( img ).first().attr( src );
});

或许可以选择等。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签