(Classic) replace_image_src()

Engine Compatibility

replace_image_src is not supported by the Node engine.

replace_image_src(<sel>, <url>)

Replace the source of the image tag having ID of <sel> with the given URL. The effect is that the picture changes without flicker on modern browsers if the image tag has height and weight attributes and replacement image has the same size.

replace_image_src("#foo", "http://example.com/image.jpg")

The following ruleset shows replace_image_src() being used

ruleset a1299x183 {
	meta {
		name "Replace Image Src Example"
		
		author "nathan cerny"
		logging off
	}
	dispatch {
		// domain "exampley.com"
	}
    
	rule replace_image {
		select when pageview ".*" setting ()
		replace_image_src('#replace_image', 'http://kynetx-images.s3.amazonaws.com/documentation/Misc/switch_01.jpg');
	}
}

The following demonstrates the preceding rule:

Copyright Picolabs | Licensed under Creative Commons.