Jump to content

Как выполнить уже существующий скрипт в загруженной в UNIURLFRAME странице?


Serg

Recommended Posts

38 minutes ago, Sherzod said:

Внутри код, должен выполняться на стороне клиента

Прошу прощения,  внутри чего.

 

39 minutes ago, Sherzod said:

Внутри код, должен выполняться на стороне клиента

 

Link to comment
Share on other sites

  • 3 years later...
On 4/13/2018 at 8:03 PM, Sherzod said:

MainForm.UniHTMLFrame1.iframe.contentWindow.funonload()

... это JS код.

На серверной стороне, один из возможных вариантов использования:

UniHTMLFrame1.JSInterface.JSCall('iframe.contentWindow.funonload', []);

 

Link to comment
Share on other sites

On 4/13/2018 at 4:22 PM, Serg said:
<!doctype html>

 

<html>

 

 

<head>

 

 

<style type="text/css">

 

 

#block {width:100px; height:100px; border:1px solid #ccc;}

 

 

</style>

 

 

 

 

<script type="text/javascript">

 

 

 

 

 

function funonload() {

 

 

    $("#block").css("background-color", "yellow");

 

 

}

 

 

 

 

 

</script>

 

 

 

 

 

<meta charset="utf-8">

 

 

 

 

 

<title>TEST</title>

 

 

</head>

 

 

<body>

 

 

 <div id="block"></div>

 

 

</body>

 

 

</html>

 

вот этот

Link to comment
Share on other sites

32 minutes ago, kazakoff said:

вот этот

Да, пожалуйста используйте UniURLFrame вместо UniHTMLFrame, и все заработает.

1. UniURLFrame1.HTML = ...

2. 

procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  UniURLFrame1.JSInterface.JSCall('iframe.contentWindow.funonload', []);
end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...